﻿using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Text;

namespace Somnus.Net.Tools
{
    public static class NetHelper
    {
        public static bool CheckNetState()
        {
            Ping pingConnected = new Ping();
            try
            {
                PingReply reply_try0 = pingConnected.Send("www.baidu.com");
                PingReply reply_try1 = pingConnected.Send("www.hust.edu.cn");
                if (reply_try0.Status == IPStatus.Success || reply_try1.Status == IPStatus.Success)
                    return true;
            }
            catch (Exception)
            {
                return false;
            }
            return false;
        }
    }
}

